package com.moyu.article.controller;

import com.moyu.article.domain.report.dto.ReportAddDTO;
import com.moyu.article.domain.report.dto.ReportQueryDTO;
import com.moyu.article.service.IReportService;
import com.moyu.common.core.controller.BaseController;
import com.moyu.common.core.domain.R;
import com.moyu.common.core.domain.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 赵彦博
 * @Date 2025/3/30 12:30
 */
@RestController
@RequestMapping("/report")
public class ReportController extends BaseController {

    @Autowired
    private IReportService reportService;

    @GetMapping("/list")
    public TableDataInfo getReportList(ReportQueryDTO reportQueryDTO) {
        return getTableDataInfo(reportService.getReportList(reportQueryDTO));
    }

    @PostMapping("/addReport")
    public R addReport(@RequestBody ReportAddDTO reportAddDTO) {
        return toR(reportService.addReport(reportAddDTO));
    }

    @PutMapping("/handle/{reportId}")
    public R handleReport(@PathVariable String reportId) {
        return toR(reportService.handleReport(reportId));
    }

    @PutMapping("/cancel/{reportId}")
    public R cancelReport(@PathVariable String reportId) {
        return toR(reportService.cancelReport(reportId));
    }
}
